using System;
using Modules.Gate;
using UnityEngine;

namespace Toolkit.GateExtend
{
    public class MaterialGate : GateBase
    {
        [SerializeField] private Material targetMat;

        private Renderer _renderer;

        private Material _defaultMat;

        private void Awake()
        {
            _renderer = GetComponent<Renderer>();
            _defaultMat = _renderer.material;
        }

        public override void Open()
        {
            _renderer.material = targetMat;
        }

        public override void Close()
        {
            _renderer.material = _defaultMat;
        }
    }
}